/*
 * Copyright (C) 2011 Dirk Weißenborn, dirk.weissenborn@gmail.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.weissenborn.colabtex.client.service;

import com.google.gwt.user.client.rpc.AsyncCallback;

/**
 * The Interface LoginService.
 */
public interface UserManagementServiceAsync {
	
	/**
	 * Login.
	 *
	 * @param userId the user id
	 * @param password the password
	 * @param callback the callback to return the session id (token)
	 */
	public void login(String userId, String password, AsyncCallback<String> callback);
	
	/**
	 * Gets the user.
	 *
	 * @param sessionID the session id
	 * @param callback the callback to return the user
	 */
	public void getUser(String sessionID, AsyncCallback<String> callback);
	
	/**
	 * Inits shiro service for authentication
	 */
	public void initShiro(AsyncCallback<Void> callback);
	
	/**
	 * Logout.
	 *
	 * @param sessionID the session id
	 */
	public void logout(String sessionID, AsyncCallback<Void> callback);
	
	/**
	 * Delete user.
	 *
	 * @param id the id
	 * @param password the password
	 */
	public void deleteUser(String id, String password, AsyncCallback<Void> callback);
	
	/**
	 * Register.
	 *
	 * @param email the email = id
	 * @param callback the callback to return whether user was registered or not
	 */
	public void register(String email, AsyncCallback<Boolean> callback);
	
	/**
	 * Reset password.
	 *
	 * @param email the email = id
	 * @param callback the callback to return whether password was reseted or not
	 */
	public void resetPassword(String email, AsyncCallback<Boolean> callback);
	
	/**
	 * Sets the new password.
	 *
	 * @param email the mail address = id
	 * @param password the password
	 * @param newPassword the new password
	 * @param callback the callback to return whether password was reseted or not
	 */
	public void setNewPassword(String email, String password, String newPassword, AsyncCallback<Boolean> callback);
	
	/**
	 * Sets the new email.
	 *
	 * @param oldAddress the old address = id
	 * @param newAddress the new address = id
	 * @param password the password
	 * @param callback the callback to return whether email = id set or not
	 */
	public void setNewEmail(String oldAddress, String newAddress, String password, AsyncCallback<Boolean> callback);
}
